

            function addArduinoCod (Blockly) {
            
                        
                        
                        
                        
                        
                        

                        
        Blockly.Arduino['EXT_TM1637_BLOCK_1607910613458'] = function(block)
        {
            let c_pin = this.getFieldValue('c_pin');
let d_pin = this.getFieldValue('d_pin');
          
            Blockly.Arduino.definitions_['include_EXT_TM1637_BLOCK_1607910613458'] = `\n#include "TM1637.h"\n#include "TimerOne.h"`;
            Blockly.Arduino.definitions_['define_EXT_TM1637_BLOCK_1607910613458'] = `#define ON 1\r\n#define OFF 0\r\n\r\nString TimeDisp = "";\r\nunsigned char ClockPoint = 1;\r\nunsigned char Update;\r\nunsigned char halfsecond = 0;\r\nunsigned char second;\r\nunsigned char minute = 0;\r\nunsigned char hour = 12;\r\n#define CLK${c_pin} ${c_pin}\r\n#define DIO${d_pin} ${d_pin}\r\nTM1637  tm1637(CLK${c_pin},DIO${d_pin});\r\nvoid TimingISR()\r\n{\r\n halfsecond ++;\r\n  Update = ON;\r\n  if(halfsecond == 2){\r\n    second ++;\r\n    if(second == 60)\r\n    {\r\n    minute ++;\r\n    if(minute == 60)\r\n    {\r\n      hour ++;\r\n      if(hour == 24)\r\n      hour = 0;\r\n      minute = 0;\r\n    }\r\n    second = 0;\r\n    }\r\n    halfsecond = 0;\r\n  }\r\n  ClockPoint = (~ClockPoint) & 0x01;\r\n}\r\nvoid TimeUpdate(void)\r\n{\r\n  if(ClockPoint)tm1637.setColonOn(false);\r\n  else tm1637.setColonOn(true);\r\n  TimeDisp  = hour / 10;\r\n  TimeDisp  += hour % 10;\r\n  TimeDisp  += minute / 10;\r\n  TimeDisp  += minute % 10;\r\n  Update = OFF;\r\n}`;
            Blockly.Arduino.definitions_['setup_EXT_TM1637_BLOCK_1607910613458'] = `tm1637.begin();\r\n  Timer1.initialize(500000);\r\n  Timer1.attachInterrupt(TimingISR);`;
             return  `\r\n`;
        }
                    

                        
        Blockly.Arduino['EXT_TM1637_BLOCK_1607910613678'] = function(block)
        {
            let intensity =  Blockly.Arduino.valueToCode(this, 'intensity', Blockly.Arduino.ORDER_ATOMIC);
          
            Blockly.Arduino.definitions_['include_EXT_TM1637_BLOCK_1607910613678'] = ``;
            Blockly.Arduino.definitions_['define_EXT_TM1637_BLOCK_1607910613678'] = ``;
            Blockly.Arduino.definitions_['setup_EXT_TM1637_BLOCK_1607910613678'] = ``;
             return  `tm1637.setBacklight(${intensity});\r\n`;
        }
                    

                        
        Blockly.Arduino['EXT_TM1637_BLOCK_1607910613785'] = function(block)
        {
            let show = Blockly.Arduino.valueToCode(this, 'show', Blockly.Arduino.ORDER_ATOMIC).replace(/'/g, '"') ;
          
            Blockly.Arduino.definitions_['include_EXT_TM1637_BLOCK_1607910613785'] = ``;
            Blockly.Arduino.definitions_['define_EXT_TM1637_BLOCK_1607910613785'] = ``;
            Blockly.Arduino.definitions_['setup_EXT_TM1637_BLOCK_1607910613785'] = ``;
             return  `tm1637.print(${show});\r\n`;
        }
                    

                        
        Blockly.Arduino['EXT_TM1637_BLOCK_1607910613912'] = function(block)
        {
            let dot = this.getFieldValue('dot');
          
            Blockly.Arduino.definitions_['include_EXT_TM1637_BLOCK_1607910613912'] = ``;
            Blockly.Arduino.definitions_['define_EXT_TM1637_BLOCK_1607910613912'] = ``;
            Blockly.Arduino.definitions_['setup_EXT_TM1637_BLOCK_1607910613912'] = ``;
             return  `tm1637.setColonOn(${dot});\r\n`;
        }
                    

                        
        Blockly.Arduino['EXT_TM1637_BLOCK_1607910614076'] = function(block)
        {
            let hour =  Blockly.Arduino.valueToCode(this, 'hour', Blockly.Arduino.ORDER_ATOMIC);
let minute =  Blockly.Arduino.valueToCode(this, 'minute', Blockly.Arduino.ORDER_ATOMIC);
          
            Blockly.Arduino.definitions_['include_EXT_TM1637_BLOCK_1607910614076'] = ``;
            Blockly.Arduino.definitions_['define_EXT_TM1637_BLOCK_1607910614076'] = ``;
            Blockly.Arduino.definitions_['setup_EXT_TM1637_BLOCK_1607910614076'] = `minute = ${minute};\r\n  hour = ${hour};`;
             return  `if(Update == ON)\r\n    {\r\n      TimeUpdate();\r\n      tm1637.print(TimeDisp);\r\n    }\r\n`;
        }
                    

                        
        Blockly.Arduino['EXT_TM1637_BLOCK_1607910614181'] = function(block)
        {
            
          
            Blockly.Arduino.definitions_['include_EXT_TM1637_BLOCK_1607910614181'] = ``;
            Blockly.Arduino.definitions_['define_EXT_TM1637_BLOCK_1607910614181'] = ``;
            Blockly.Arduino.definitions_['setup_EXT_TM1637_BLOCK_1607910614181'] = ``;
             return  `tm1637.clear();\r\n`;
        }
                    
            return Blockly;
            }

            module.exports = addArduinoCod ;

        